#include <bits/stdc++.h>

#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T>inline void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T>inline void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

template <int P>
class mod_int {
  using Z = mod_int;

private:
  static int mo(int x) { return x < 0 ? x + P : x; }

public:
  int x;
  int val() const { return x; }
  mod_int() : x(0) {}
  template <class T>
  mod_int(const T &x_) : x(x_ >= 0 && x_ < P ? static_cast<int>(x_) : mo(static_cast<int>(x_ % P))) {}
  bool operator==(const Z &rhs) const { return x == rhs.x; }
  bool operator!=(const Z &rhs) const { return x != rhs.x; }
  Z operator-() const { return Z(x ? P - x : 0); }
  Z pow(long long k) const {
    Z res = 1, t = *this;
    while (k) {
      if (k & 1) res *= t;
      if (k >>= 1) t *= t;
    }
    return res;
  }
  Z &operator++() {
    x < P - 1 ? ++x : x = 0;
    return *this;
  }
  Z &operator--() {
    x ? --x : x = P - 1;
    return *this;
  }
  Z operator++(int) {
    Z ret = x;
    x < P - 1 ? ++x : x = 0;
    return ret;
  }
  Z operator--(int) {
    Z ret = x;
    x ? --x : x = P - 1;
    return ret;
  }
  Z inv() const { return pow(P - 2); }
  Z &operator+=(const Z &rhs) {
    (x += rhs.x) >= P && (x -= P);
    return *this;
  }
  Z &operator-=(const Z &rhs) {
    (x -= rhs.x) < 0 && (x += P);
    return *this;
  }
  Z &operator*=(const Z &rhs) {
    x = 1ULL * x * rhs.x % P;
    return *this;
  }
  Z &operator/=(const Z &rhs) { return *this *= rhs.inv(); }
#define setO(T, o)                                 \
  friend T operator o(const Z &lhs, const Z &rhs) {\
    Z res = lhs;                                   \
    return res o## = rhs;                          \
  }
  setO(Z, +) setO(Z, -) setO(Z, *) setO(Z, /)
#undef setO
};
const int P = 998244353;
using Z = mod_int<P>;

const int maxn = 300010;
const Z iv2 = (P + 1) >> 1;

Z fac[maxn], ivf[maxn];
int n, k, q, a[maxn];

Z binom(int x, int y) {
  if (x < 0 || y < 0 || x < y) return 0;
  return fac[x] * ivf[y] * ivf[x - y];
}

struct mat {
  Z a[7][7];
  void clear() {
    rep (i, 0, 6) rep (j, 0, 6) a[i][j] = 0;
  }
  void init() {
    rep (i, 0, 6) rep (j, 0, 6) a[i][j] = (i == j ? 1 : 0);
  }
  friend mat operator*(mat x, mat y) {
    mat res;
    rep (i, 0, 6) rep (j, 0, 6) rep (k, 0, 6) res.a[i][j] += x.a[i][k] * y.a[k][j];
    return res;
  }
} M, R;

Z p[7], t[maxn], coe[3], m[3][7], cnt[maxn], pos[maxn], ans;

void upd(int x, Z v) {
  while (x <= n) t[x] += v, x += x & (-x);
}

Z qry(int x) {
  Z res = 0;
  while (x) res += t[x], x -= x & (-x);
  return res;
}

void solve() {
  rep (i, 0, 2) {
    coe[i] = 0;
    rep (j, 0, 6) coe[i] += m[i][j] * p[j];
  }
  rep (i, 1, n) ans += cnt[i] * coe[0] + cnt[i] * i * coe[2] + pos[i] * coe[1];
}

void rev() {
  rep (i, 1, n) cnt[i] = i - cnt[i] - 1;
  rep (i, 1, n) pos[i] = Z(i) * (i - 1) * iv2 - pos[i];
  rep (i, 0, 6) m[0][i] = 1 - m[0][i];
  rep (j, 1, 2) rep (i, 0, 6) m[j][i] = P - m[j][i];
}

Z calc(int k){
  ans = 0;
  memset(m, 0, sizeof(m));
  Z A = n - 2, B = n - 3, C = Z(n - 2) * (n - 3) * iv2;
  Z D = C + n - 3, E = C + 2 * n - 7;
  M = (mat){{
    {C, 1, 1, 0, 1, 0, 0},
    {1, C, 0, 1, 0, 1, 0},
    {A, 0, D, 1, 0, 1, 1},
    {0, A, 1, D, 1, 0, 1},
    {A, 0, 0, 1, D, 1, 1},
    {0, A, 1, 0, 1, D, 1},
    {0, 0, B, B, B, B, E},
  }};
  R.init();
  while (k) {
    if (k & 1) R = R * M;
    M = M * M, k >>= 1;
  }
  rep (i, 0, 6) p[i] = R.a[i][0];
  rep (i, 1, n) cnt[i] = qry(a[i]), upd(a[i], 1);
  rep (i, 1, n) t[i] = 0;
  rep (i, 1, n) pos[i] = qry(a[i]), upd(a[i], i);
  rep (i, 1, n) t[i] = 0;
  Z iv = Z(n - 2).inv();
  m[0][1] = 1, m[0][2] = n * iv, m[0][3] = Z(P - 2) * iv;
  m[0][4] = -iv, m[0][5] = Z(n - 1) * iv, m[0][6] = iv2;
  m[1][4] = iv, m[1][5] = -iv, m[2][2] = -iv, m[2][3] = iv;
  solve(), rev(), solve();
  return ans;
}

int main() {
  freopen("random.in", "r", stdin);
  freopen("random.out", "w", stdout);
  fac[0] = 1;
  rep (i, 1, maxn - 1) fac[i] = fac[i - 1] * i;
  ivf[maxn - 1] = fac[maxn - 1].inv();
  per (i, maxn - 1, 1) ivf[i - 1] = ivf[i] * i;
  cin.tie(nullptr) -> ios::sync_with_stdio(false);
  cin >> n >> k >> q;
  rep (i, 1, n) cin >> a[i];
  cout << (calc(k) * (Z(n) * (n - 1) * iv2).pow(k).inv()).val() << '\n';
  rep (w, 1, q) {
    int x, y;
    cin >> x >> y;
    swap(a[x], a[y]);
    cout << (calc(k - w) * (Z(n) * (n - 1) * iv2).pow(k - w).inv()).val() << '\n';
  }
}